perm filename TAPE.RPH[S,DOC]4 blob sn#255417 filedate 1976-12-25 generic text, type T, neo UTF8
STANFORD ARTIFICIAL INTELLIGENCE LABORATORY		NOVEMBER 1971
OPERATING NOTE 65
	








				TAPE
				 by
			RICHARD P. HELLIWELL






Abstract

TAPE is a program for reading non-standard magnetic tapes. One of its
saving  features is that it can determine density, parity, and length
of a given record with reasonable certainty.























This work was supported in part by the The Advanced Research Projects
Agency of the Department of Defense under Contract SD-183.
	To initialize TAPE type the following system level command:

		R TAPE<cr>

	The program will respond with:

		LOGICAL NAME OF MAGTAPE DRIVE?

	        If you type <cr> at this point logical MTA0  will  be
assumed.  The  program  will  type out the initial default parity and
density (record length is set to 0). Now you are in the command loop.
TAPE will type:

		COMMAND?

	At this point you may type one of the following commands:

	W	REWIND
	An	ADVANCE FILE
	Bn	BACKSPACE FILE
	ARn	ADVANCE RECORD
	BRn	BACKSPACE RECORD
	WEn	WRITE EOF
	WBn	WRITE 3" OF BLANK TAPE
	T	ADVANCE TO LOGICAL EOT
	SP	SET PARITY
	SDn	SET DENSITY TO n
	SLn	SET RECORD LENGTH(IN DECIMAL WORDS) TO n
	C	DETERMINE DENSITY, PARITY, AND LENGTH OF CURRENT RECORD
	CL	DETERMINE LENGTH OF CURRENT RECORD
	G	GO TO READ/WRITE LOOP
	D	CALL DDT (IF LOADED)
	?	PRINT THIS LIST

        where "n" refers to a positive decimal integer. Any operation
which  causes you to reach the physical end of tape or the load point
will indicate said condition.

An

	Advances over "n" end of files. This means that  if  you  are
anywhere in a file "A" will get you to the beginning of the next one.
"An" will get you to the beginning of the nth file after the  current
one.

Bn

	Does a backspace record, then backspaces over "n" end of file
marks,  and  if  not then at load point advances over the last end of
file. This means that if you are at the front of a file "Bn" backs up
to the front of the nth file before this one. However if you  are  in
the  middle  of  the file somewhere, you back up to the front of this
file and then backs up to the front of the  n-1th  file  before  this
one.

SP

        "SET  PARITY" will ask "WHAT PARITY?", to which you may reply
"ODD", "EVEN", or <cr> (default "ODD").

SD

        "SET  DENSITY" will set the tape density in BPI to "n", where
"n" is "200", "556", or "800". If "n"=0 TAPE will ask "WHAT DENSITY?"
and  then  read the number. <cr> at this point will get default "556"
BPI density.

SL

        "SET  RECORD  LENGTH"  works  similar  to  "SET DENSITY". Any
non-zero record length is legal (please use discretion).

C

        This  causes  TAPE to read the current record in all parities
and densities to determine what format the tape was  written  in.  If
the parity or density is not unique, you will be asked to specify the
parity or density. Then a "CL" is done.

CL

        The  current  record  is  read  twice to determine the record
length. The length in decimal and octal words is  printed,  any  read
errors are indicated.

G

        This command enters the TAPE read/write loop.  TAPE  responds
with:

		TAPE MODE(S)?

	You are now in the "TAPE LOOP", see next page.
TAPE LOOP:

        Tape  loop will  now accept  a string  containing any  of the
following characters:

	?	PRINT THIS LIST
	$	<ALTMODE> GET OUT OF TAPE LOOP
	D	CALL DDT (IF LOADED)
	T	TOTAPE
	F	FROMTAPE
	B	BCD CONVERSION
	E	EBCDIC CONVERSION
	I	EBCDIC INCOMPATIBILITY MODE (FROMTAPE ONLY)
	N	DELETE EVERYTHING FROM COLUMN 73 TO END OF LINE(FROMTAPE)
		IGNORE LINE NUMBERS AND PAGE MARKS(TOTAPE)
	C	CONVERT MULTIPLE SPACES TO TABS AND DELETE TRAILING SPACES
		(FROMTAPE ONLY)

?

        All other characters in the string are ignored and  the  list
is printed. TAPE then types "TAPE MODE(S)?" again.

$

        <altmode>  ignores  all  other  characters  and  returns   to
"COMMAND" loop.

        All other commands work as expected, any  conflict  of  modes
will cause "ILLEGAL MODES!" and "TAPE MODE(S)?" to be typed.

        If direction or conversion format are omitted,  the  defaults
"FROM  TAPE"  and "BCD" will be used. If the modes are legal they are
printed for  you. TAPE then  calculates the  maximum # of  characters
per  record and prints it.  It then asks you  how many characters you
want per record. If  you type <cr>, the  maximum # of characters  per
record  will be  used,  altmode  gets you  back  to "COMMAND"  level,
otherwise the  number you type will be used (if less than or equal to
maximum).

	Record blocking is always preserved. On input,  when the # of
characters per  record runs out a crlf  is inserted and input resumes
with the next  record. On output,  when end of  line is reached,  the
record is  written. If a line  is longer than 72  characters, 8 stars
are  put out and the  line continues on the  next record. If sequence
numbers are being generated,  they are put in columns  73-80. Columns
73-75 are the page #, 76-80 are the line #.

        At this point you are asked for  the  disk  filename  (either
input  or  output).  A  standard  file  specification may be used (no
"*"'s). A null file spec gets you back to "COMMAND" level.

	Now the transfer  takes place any errors will be  referred to
you.  At the  end of  the  transfer you  return  to "COMMAND"  level.
During  the transfer  certain characters  may be  seen which  have no
representation in  the  other character  set.   For  conversion  from
either  BCD  or EBCDIC  to  ASCII,   the  character  "∀"  is used  to
indicate  all characters which have no  representation in ASCII.  For
ASCII to BCD  conversion,   the octal code  32 is used  (this is a  2
tier  telephone pole). For  ASCII to  EBCDIC, the  octal code  112 is
used (this is a cent sign).

EBCDIC INCOMPATIBILITY MODE:

	This losing mode is  a way getting an 8 bit  EBCDIC code into
a  6 bit byte. This  is done by writing  the low order 6  bits of the
EBCDIC code. On  input 300  (octal) is added  to the 6  bit code.  If
this yields an illegal character, then  200 is subtracted and you are
stuck with that.
        Now  I will show a trial run, user responses will be shown in
lower case (which is legal input):




r tape<cr>
LOGICAL NAME OF MAGTAPE DRIVE?<cr>
DEFAULT MTA0
INITIAL DEFAULT: ODD PARITY 556 BPI!

COMMAND?w<cr>
AT LOAD POINT!

COMMAND?c<cr>
TAPE PARITY:EVEN
USING 800 BPI
14 (DECIMAL) 16 (OCTAL) WORDS PER RECORD

COMMAND?g<cr>
	TAPE MODE(S)?<cr>
	DEFAULT FROMTAPE
	DEFAULT BCD
	PROBABLY 84 CHARS PER CARD
	NUMBER OF CHARS PER CARD?<cr>
	OUTPUT FILENAME?foo.dat[1,foo]<cr>
<transfer takes place>
COMMAND?


Now wasn't that simple?